<%@page contentType="text/html; charset=utf-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="primus" tagdir="/WEB-INF/tags" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<primus:page title="添加广告位">
    <jsp:attribute name="script">
    </jsp:attribute>
    <jsp:body>
        <div class="breadcrumbs ace-save-state" id="breadcrumbs">
            <ul class="breadcrumb">
                <li>
                    <i class="ace-icon fa fa-home home-icon"></i>
                    <a href="welcome.do">
                        首页
                    </a>
                </li>
                <li>
                    运营管理
                </li>
                <li class="active">
                    添加广告位
                </li>
            </ul>
            <a class="btn btn-xs btn-primary history-back">
                <i class="ace-icon fa fa-angle-left"></i>
                返回
            </a>
        </div>
        <div class="page-content">
            <h3 class="header smaller lighter blue">
                广告位数据
            </h3>

            <div class="row">
                <div class="col-xs-12">
                    <!-- PAGE CONTENT BEGINS -->
                    <form id="contact-form" action="advertisement/adv/save.do" method="post" class="form-horizontal"
                          role="form">
                        <input type="hidden" name="id" id="id" value="${adPosition.id}"/>
                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right" for="name"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"> 名称 </font></font></label>
                            <div class="col-sm-9">
                                <input type="text" id="name" name="name" placeholder="名称" value="${adPosition.name}" class="col-xs-10 col-sm-5">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right" for="width"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"> 宽度 </font></font></label>
                            <div class="col-sm-2">
                                <input type="number" step="1" min="1" id="width" name="width" value="${adPosition.width}" class="input-sm col-xs-10 col-sm-5" style="width: 8em">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right" for="height"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"> 高度 </font></font></label>
                            <div class="col-sm-2">
                                <input type="number" step="1" min="1" id="height" name="height" value="${adPosition.height}" class="input-sm col-xs-10 col-sm-5" style="width: 8em">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right" for="description"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"> 描述 </font></font></label>
                            <div class="col-sm-9">
                                <input type="text" id="description" name="description" value="${adPosition.description}" placeholder="描述" class="form-control">
                            </div>
                        </div>

                        <div class="space-4"></div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right">
                                是否启用
                            </label>
                            <div class="col-sm-2">
                                <select name="invalid" id="invalid" data-placeholder="是否启用..." class="chosen-select form-control col-xs-12">
                                    <c:choose>
                                        <c:when test="${adPosition.invalid}">
                                            <option name="invalid" value="true" selected="selected">启用</option>
                                            <option name="invalid" value="false">禁用</option>
                                        </c:when>
                                        <c:otherwise>
                                            <option name="invalid" value="true">启用</option>
                                            <option name="invalid" value="false" selected="selected">禁用</option>
                                        </c:otherwise>
                                    </c:choose>
                                </select>
                            </div>
                        </div>

                        <div class="space-4"></div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right">
                                使用位置
                            </label>
                            <div class="col-sm-9">
                                <select name="adUsePlace" id="adUsePlace" data-placeholder="选择广告位使用的位置" class="chosen-select form-control col-xs-12">
                                    <c:forEach items="${adUsePlaceEnums}" var="adUsePlaceEnum">
                                        <c:choose>
                                            <c:when test="${adPosition.adUsePlace.name() eq adUsePlaceEnum.name()}">
                                                <option value="${adUsePlaceEnum.name()}" selected>${adUsePlaceEnum.desc}</option>
                                            </c:when>
                                            <c:otherwise>
                                                <option value="${adUsePlaceEnum.name()}" >${adUsePlaceEnum.desc}</option>
                                            </c:otherwise>
                                        </c:choose>
                                    </c:forEach>
                                </select>
                            </div>

                        </div>

                            <div class="form-group">
                                <label  class="col-sm-3 control-label no-padding-right">客户端
                                </label>
                                <div class="col-sm-9">
                                    <c:forEach items="${useTypeEnums}" var="useTypeEnum">
                                        <c:choose>
                                            <c:when test="${adPosition.useType.name() eq useTypeEnum.name()}">
                                                <input type="radio" name="useType" value="${useTypeEnum.name()}" checked>${useTypeEnum.desc}
                                            </c:when>
                                            <c:otherwise>
                                                <input type="radio" name="useType" value="${useTypeEnum.name()}">${useTypeEnum.desc}
                                            </c:otherwise>
                                        </c:choose>
                                    </c:forEach>
                                </div>
                            </div>


                        <div class="space-4"></div>
                        <div class="space-4"></div>
                        <div class="clearfix form-actions">
                            <div class="col-md-offset-3 col-md-9">
                                <button class="btn btn-info" type="submit" id="btn_save">
                                    <i class="ace-icon fa fa-check bigger-110"></i>
                                    保存
                                </button>

                                &nbsp; &nbsp; &nbsp;
                                <button class="btn" type="reset">
                                    <i class="ace-icon fa fa-undo bigger-110"></i>
                                    重置
                                </button>
                            </div>
                        </div>
                    </form>
                </div><!-- /.col -->
            </div>
        </div>
    </jsp:body>
</primus:page>
